The present invention relates to a remainder calculating method and apparatus, a modular-multiplication method and apparatus, and a recording medium, which are suitable for a remainder calculation, a modular-multiplication in RSA encryption processing, elliptic curve encryption processing of a public key cryptosystem. In particular, the present invention relates to a remainder calculating method and apparatus, a modular-multiplication method and apparatus, and a recording medium, which can carry out a calculation at a high speed with the use of Montgomery algorithm (see Modular Multiplication Without Trial Division. Peter L. Montgomery, Mathematics of Computation, Volume 44, Number 170, April 1985 pp. 519-521).
In recent years, the development of a computer network has rapidly increased an opportunity to retrieve a data base, or to send and receive electronic information such as an electronic mail and electronic news via a network. Moreover, an on-line shopping service or the like is provided by making use of the computer network. However, with the development of the computer network, the following problems have been pointed out; more specifically, electronic data on the network is tapped or falsified, and a certain person pretends to be another person so as to receive service without charge. In particular, tapping is easy in a network using a radio communication; for this reason, it is desired to take suitable measures for preventing the tapping.
In order to solve the aforesaid problems, an encryption electronic mail system and a user certification system using cryptography are proposed, and then, are being introduced into various networks. Therefore, it is a matter of course that encryption is an indispensable technology in the computer network. As one of the above cryptography, there is a public key cryptosystem which is suitable for digital signature, that is, for certification. However, a large quantity of processing is required for encryption/decryption;
for this reason, it is desired to carry out the encryption/decryption processing at a high speed, and various high-speed algorithms have been published.
The above cryptosystem is largely classified into two, that is, a secret key cryptosystem and a public key cryptosystem. The secret key cryptosystem is a system such that a sender and a receiver mutually have the same cryptographic key so as to carry out a cryptographic communication. More specifically, in the secret key cryptosystem, a certain message is encrypted on the basis of a secret cryptographic key, and thereafter, is sent to a receiver. Then, the receiver decrypts the encrypted message with the use of the cryptographic key so as to return it to the original message, and thus, obtains an information.
The public key cryptosystem is a system such that a sender encrypts a message with the use of a published receiver""s public key, so as to send it to the receiver, and then, the receiver decrypts the encrypted message with the use of his secret key, and thus, a communication is performed. More specifically, in the public key cryptosystem, the public key is a key used for encryption, and the secret key is a key used for decrypting a message encrypted by the public key, and further, the message encrypted by the public key can be decrypted by only secret key.
In the aforesaid secret key cryptosystem, a key, in which a private individual must keep in secret, requires by the number of communicating partners, and the total number of required keys is n(nxe2x88x921)/2 in the case of n person network. Moreover, the secret key cryptosystem has a problem that a secret key must be distributed according to a certain method with respect to a partner who makes a communication for the first time. In order to solve the problem, a key control center is established in a large scale network, and the private individual keeps only secret key between the center and himself. In the case of carrying out a cryptographic communication, a method of obtaining a secret key with the communicating partner from the center is employed. In this case, the total number of secret keys is n.
On the other hand, in the public key cryptosystem, a key, in which a private individual should keep in secret, is only his own secret key, and the total number of required secret keys is n in the case of n person network. Moreover, a public key may be only distributed with respect to a partner who makes a communication for the first time, and a key control center is established. Then, n users"" public keys are registered in a public board, and a method of obtaining a public key of the communicating partner from the center is employed. In this case, the center merely prevents a falsification of the public key, and has no need of keeping the public key in secret. However, in the public key cryptosystem, the number of bits of the public key is much as compared with the secret key cryptosystem; for this reason, a file size required for storing it becomes large.
In the case of certification, in the secret key cryptosystem, for example, a message to be sent is compressed and converted with the use of a secret key, and then, is sent in a state of being added to a sending text. In a receiving end, the message is compressed and converted, and then, makes a comparison. In this case, however, send/receive is carried out with the use of the same key; for this reason, a receiver can counterfeit a certification data. On the contrary, the public key cryptosystem makes use of the feature that it is only person himself to encrypt the message with the use of the secret key. A sender compresses and converts the message, and then, encrypts it with the use of the secret key, and thus, sends it in a state of being added to a sending text. On the other hand, the receiver decrypts the added data with the use of sender""s public key, and then, makes a comparison with the message similarly compressed and converted. In this case, the receiver can not make an illegal act.
As described above, in the certification system, the technology of public key cryptosystem is indispensable. However, the public key cryptosystem has a severe problem that a large quantity of processing is required for encryption/decryption. For this reason, in general, the secret key cryptosystem of high speed processing is used for an encryption of message, and the public key cryptosystem is used for certification, and thus, the above two cryptosystems are often used in combination with each other.
The public key cryptosystem mainly includes an RSA cryptosystem and an elliptic curve cryptosystem. In particular, the elliptic curve cryptosystem is noticeable because a small number of bits is required for obtaining the same safety as the RSA cryptosystem. In the elliptic curve cryptosystem, there are a cryptosystem defined on a prime field and a cryptosystem defined on two extension fields, and both cryptosystems are based on a discrete logarithm problem on an elliptic curve. A basic calculation of the elliptic curve cryptosystem is an addition of points on an elliptic curve. The following is a description on an additive algorithm in points on an elliptic curve on a prime field. (Additive algorithm in points on an elliptic curve on a prime field)
elliptic curve: y2=x3+ax+b (mod N), N: prime number
two points to be added: (X1, y1), (x2, y2)
additive result: (x3, y3)
An addition on points is expressed as follows
x3=xcex2xe2x88x92x1xe2x88x92x2 (mod N);
y3=xcex(x1xe2x88x92x3)xe2x88x92y1 (mod N);
xcex=(y2xe2x88x92y1)/(x2xe2x88x92x1) (mod N)
In general, N, a, b, x1, y1, x2 and y2 are integers each of which has a size of about 160 bits. In the elliptic curve cryptosystem, a great many of the above basic calculations are repeatedly carried out; as a result, a large quantity of multiple precision multiplications and remainder calculations are carried out. For this reason, various high-speed methods such as approximate method, remainder table system, Montgomery""s algorithm are proposed as the remainder calculation. Further, unlike the RSA cryptosystem, in the elliptic curve cryptosystem, even in the case where a specific value such as a Mersenne prime number (2nxe2x88x921) is used as a modulus N of remainder, no influence is given to safety; therefore, there has been proposed a high-speed processing method using the specific value as a modulus N of remainder.
The following is a description on a Montgomery""s algorithm which is one method for realizing high-speed processing of the remainder calculation.
(Montgomery Algorithm)
Montgomery algorithm is the following algorithm; more specifically, when using a modulus N (N greater than 1) of remainder and a base R (R greater than N) which is relatively prime with the modulus N of remainder, a calculation of TRxe2x88x921 mod N from a dividend T is performed by carrying out a division by only base R, and by taking advantage of this merit, a remainder calculation is carried out without using a division by N. In this case, each of N, Nxe2x80x2, R, Rxe2x88x921 and T is an integer, the dividend T satisfies a relation of 0xe2x89xa6T less than Rxc2x7N, Rxe2x88x921 is an inverse number of the base R on the modulus N of remainder, and a relation of Rxc2x7Rxe2x88x921xe2x88x92Nxc2x7Nxe2x80x2=1 (0xe2x89xa6Rxe2x88x921 less than N, 0xe2x89xa6Nxe2x80x2 less than R) is satisfied.
Moreover, in the case of using a power of 2 as the base R, the division by the base R is replaced with a shift operation; therefore, it is possible to process the above calculation of Txe2x86x92TRxe2x88x921 mod N at a high speed. Next, the following is a description on an algorithm REDC(T) of Txe2x86x92TRxe2x88x921 mod N used as an (Algorithm 1). In the (algorithm 1), it has been proved that (T+mxc2x7N)/R is necessarily divisible.
(Algorithm 1)
An algorithm Y=REDC(T) of Txe2x86x92TRxe2x88x921 mod N is expressed as follows.
M=(T mod R)xc2x7Nxe2x80x2 mod R
Y=(T+Mxc2x7N)/R
if
Yxe2x89xa7N then Y=Yxe2x88x92N
Y less than N then return Y
In one-time REDC, a remainder T mod N is not obtained, but only TRxe2x88x921 mod N is obtained. Therefore, in order to obtain the remainder T mod N, the REDC is again carried out with in the following manner by the use of a product of REDC(T) and R2 mod N which has been previously obtained.
REDC(REDC(T)xc2x7(R2 mod N))=(TRxe2x88x921 mod N)xc2x7(R2 mod N)xc2x7Rxe2x88x921 mod N=TRxe2x88x921xc2x7R2xc2x7Rxe2x88x921 mod N=T mod N
In the manner as described above, it is possible to obtain the remainder T mod N.
(Extension of REDC to Multiple Precision Calculation)
In the case where the modulus N of remainder or base R is multi length, that is, multiple precision, the algorithm of REDC is extended. In the case where the modulus N of remainder or base R is multiple precision, the calculation of (T mod R)xc2x7Nxe2x80x2 and Mxc2x7N of REDC becomes multiple precisionxc3x97multiple precision processing; for this reason, a large quantity of processing and processing time are required in a general computer. In order to avoid the large quantity of processing, the following is shown an (Algorithm 2) in which the above processing is extended so as to be carried out by multiple precisionxc3x97single precision processing.
(Algorithm 2)
The following is an algorithm in which the REDC is extended to the multiple precision.
A dividend T, a parameter Nxe2x80x2 and an output variable Y are all r-adic, and
T=(t2gxe2x88x921, t2gxe2x88x922, . . . , t0)r,
Nxe2x80x2=(nxe2x80x2gxe2x88x921, nxe2x80x2gxe2x88x922, . . . , nxe2x80x20)r,
Y=(yg, ygxe2x88x921, . . . , y0)r,
R=rg,
r=2k
In the case where the condition is expressed as shown above, it is possible to obtain TRxe2x88x921 mod N as a calculation of multiple precisionxc3x97single precision by the following repetitive processing of j=0 to gxe2x88x921. In this case, the single precision means r-adic one digit, and in the case of using the same character, basically, a large character means a multiple precision, a small character means a single precision, and a small character subscript means a digit of multiple precision. FIG. 1 is a view showing a remainder calculating process by the (Algorithm 2).
Y=T
for j=0 to gxe2x88x921
m=y0xc2x7nxe2x80x20 mod r
Y=Y+mxc2x7N
Y=Y/r
next
if
Yxe2x89xa7N then Y=Yxe2x88x92N
Y less than N then return Y
Then, with the use of a product of the TRxe2x88x921 mod N thus obtained and the previously obtained R2 mod N, the REDC is again carried out, and thereby, a remainder T mod N can be obtained.
(Extension of REDC to Multiple Precision Modular-multiplication)
Next, an REDC algorithm is extended to a modular-multiplication. In the above Algorithm 2, although an input T is a value satisfying a relation of 0xe2x89xa6T less than Rxc2x7N, the input T is often a multiplicative result of integers A and B (0xe2x89xa6A, B less than N). In this case, the multiplication of the integers A and B is a multiple precision integer calculation; for this reason, a repetitive calculation as a multiple precision extension REDC is carried out. In this case, when multiplication and REDC are repeatedly calculated independently from each other, a loss by repetitive computational control becomes twice. In order to avoid the above disadvantage, the following is an (Algorithm 3) in which the multiplication and REDC are extended so as to be carried out by the identical repetitive loop.
(Algorithm 3)
The following is an Algorithm REDC (Axc3x97B) which extends the REDC to multiple precision modular-multiplication. Two multipliers A and B, a parameter. Nxe2x80x2 and an output variable Y are all r-adic, and
A=(agxe2x88x921, agxe2x88x922, . . . . , a0)r,
B=(bgxe2x88x921, bgxe2x88x922, . . . , b0)r,
Nxe2x80x2=(nxe2x80x2gxe2x88x921, nxe2x80x2gxe2x88x922, . . . , nxe2x80x20)r,
Y=(yg, ygxe2x88x921, . . . , y0)r,
R=rg,
r=2k
In the case where the condition is expressed as shown above, it is possible to obtain ABRxe2x88x921 mod N as a calculation multiple precisionxc3x97single precision by the following repetitive processing of j=0 to gxe2x88x921. FIG. 2 is a view showing a modular-multiplication process by the (Algorithm 3).
Y=0
for j=0 to gxe2x88x921
Y=Y+Axc2x7bj
m=y0xc2x7nxe2x80x20 mod r
Y=Y+mxc2x7N
Y=Y/r
next
if
Yxe2x89xa7N then Y=Yxe2x88x92N
Y less than N then return Y
Then, with the use of a product of the ABRxe2x88x921 mod N thus obtained and the previously obtained R2 mod N, the REDC is again carried out, and thereby, a remainder Axc2x7B mod N can be obtained.
As described above, in the elliptic curve cryptosystem, even if a specific prime number (specific parameter) is used as a modulus of remainder, a safety is not lost, and therefore, there is a method such that the specific parameter is used as a divisor so as to carry out a remainder calculation at a high speed. The above method has been conventionally proposed in U.S. Pat. Nos. 5,271,061, 5,159,632, 5,442,707, etc. However, methods proposed in these USPs are not a method of using the specific parameter as a divisor in the case of carrying out a remainder calculation on the basis of a Montgomery method.
One method of the Montgomery method using a specific parameter has been proposed at a general meeting of the electronic information and communication society in 1988 (A-7-11: elliptic curve cryptosystem applying Montgomery arithmetic). This method is as follows. In the case of carrying out a Montgomery remainder of a value C, assuming that a condition of N=xcex52Lxe2x88x92Kxe2x88x921 (L: number of bits of N, k: number of bits of processing unit, xcex5: k bits) is set as a divisor N, the Montgomery remainder of a value C becomes equal to a Montgomery remainder of ((C/2Lxe2x88x92K)+xcex5 (C mod 2Lxe2x88x92K)). Thus, the Montgomery remainder of a value C is obtained by carrying out one-time multiplication processing of multiple precisionxc3x97multiple precision; on the other hand, by using the specific parameter, the Montgomery remainder of a value C is obtained by carrying out two-time multiplication processings of multiple precisionxc3x97single precision.
However, according to the above method, a dimension of number for carrying out a Montgomery division is decreased, and thereby, a computational complexity is merely reduced. Namely, the method does not achieve a reduction of a computational complexity of the Montgomery division by using the specific parameter. Moreover, the used specific parameter has a great limitation of xcex52Lxe2x88x92Kxe2x88x921.
It is, therefore, a principal object of the present invention to provide a remainder calculating method and apparatus, and a modular-multiplication method and apparatus, which uses a specific parameter having a small limitation such as c2dxe2x88x921 or c2d+1 as a divisor so as to simplify a remainder calculation and modular-multiplication on the basis of a Montgomery method and to reduce a computational complexity as compared with a conventional case.
Further, another object of the present invention is to provide a recording medium which records a computer readable program for causing a computer to execute the aforesaid remainder method and modular-multiplication method.
According to the present invention, in the remainder method and modular-multiplication method on the basis of a Montgomery method, a number expressed by N=c2dxc2x11 is used as a divisor N. For example, in calculating a remainder of the case where a dividend Y is divided by a divisor N, a number expressed by N=c2dxe2x88x921 is used as the divisor N, and then, the following steps are repeated. More specifically, the steps include a steps of adding a product of a least digit value yo of the dividend Y and c to a lower d-bit position of the dividend Y, and a step of using a portion excluding the least digit of the additive result as a next dividend.
Thus, it is possible to simplify a calculation in Montgomery remainder method and Montgomery modular-multiplication method so as to reduce a computational complexity.
The above and further objects and features of the invention will more fully be apparent from the following detailed description with accompanying drawings.